﻿@section footer{
    <script type="text/javascript">
        $().ready(function () {
            var items = [];
            $.post("/System/GetButtons", { MenuNo: "Permission" }, function (data) {
                for (var i = 0; i < data.length; i++) {
                    items[i] = { text: data[i].text, id: data[i].id, click: itemclick };
                }
            }, "json");

            var grid = $("#list").ligerGrid({
                columns: [
              { display: '控制器', name: 'Controller',isSort :false, align: 'left', width: 150, minWidth: 60
               // ,validate: { required: true }
              //  , editor: {type: 'text'}
                },
                { display: '动作', name: 'Action',isSort :false, align: 'left', width: 200, minWidth: 60
                , validate: { required: true }
                , editor: {type: 'select',
                 ext:
                    function (rowdata) {
                        return {
                            onBeforeOpen:function(){
                             selectCombox=this;
                             f_selectContact();
                           
                             return false;
                             }
                           ,
                            render: function () {
                                return rowdata.Action;
                            }
                        };
                    }
                } , render: function (item) {
                    return  item.Action;
                }
                 },
                { display: '权限名称', name: 'Name', align: 'left', width: 150, minWidth: 60
                , validate: { required: true }
                , editor: { type: 'text' }
                },
             
                { display: 'ID', name: 'ID', align: 'left', width: 100, minWidth: 60
                 ,hide:true},
                  { display: '父级ID', name: 'ParentID', align: 'left', width: 100, minWidth: 60
                 ,hide:true},
                 { display: '执行脚本', name: 'Script',isSort :false, align: 'left', width: 150, minWidth: 60
                 ,hide:true
//                ,validate: { required: true }
//                , editor: {type: 'text'}
                },
              
                  { display: '图标', name: 'Icon',isSort :false, align: 'left', width: 50, minWidth: 50
                , editor: { type: 'select',
                    ext:
                    function (rowdata) {
                        return {
                            onBeforeOpen: function () {
                                currentComboBox = this;
                                f_openIconsWin();
                                return false;
                            },
                            render: function () {
                                return rowdata.Icon;
                            }
                        };
                    }
                }
                , render: function (item) {
                    return "<div style='width:100%;height:100%;'><img src='" + item.Icon + "' /></div>";
                }
             },
              { display: '是否为按钮', name: 'IsButton', align: 'left', width: 80, minWidth: 60
                , validate: { required: true }
                , editor: { type: 'checkbox' }
                , render: function (item) {
                    if(item.IsButton)
                    return "按钮";
                    else
                    return "普通请求";
                }
                },
              { display: '是否删除', name: 'IsVisible', align: 'left', width: 60, minWidth: 60
                , validate: { required: true }
                , editor: { type: 'checkbox' }
                , render: function (item) {
                    if(item.IsVisible)
                    return "正常";
                    else
                    return "删除";
                }
                },
                 { display: '描述', name: 'Description', align: 'left', width: 500, minWidth: 60
                  , editor: { type: 'text' }
                   }
            ],
                dataAction: 'server', pageSize: 20,
                url: "/Customer/GetGrid", sortName: 'CustomerID', sortOrder: 'asc',rownumbers:true,
                width: '98%', height: '100%', heightDiff: -10, checkbox: false, toolbar: { items: items }
            });

            function itemclick() { }
        });

    </script>
}